public class Bus extends Vehicle {
    //乘客成员变量
    int passenger;

    //上车方法
    public void gotOn(int num){
        passenger += num;
        System.out.println(num + "名乘客上车！" + "车厢现有" + passenger + "人");
    }

    //下车方法
    public void getOff(int num){
        if(num <= passenger) {
            passenger -= num;
            System.out.println(num + "名乘客下车！" + "车厢还有" + passenger + "人");
        }else {
            System.out.println("下车人数超过当前乘客错误！！！");
        }
    }
}
